<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title></title>
  </head>
  <body>
    <div id="app">
      <h1 v-if="firstName">{{ firstName }}</h1>
      <h2 v-if="lastName">{{ lastName }}</h2>
      <h2 v-else>没有 lastName</h2>
    </div>

    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script>
      const { createApp, ref } = Vue;

      createApp({
        setup() {
          const firstName = ref("编程段子");
          const lastName = ref();

          setTimeout(() => (lastName.value = "Vue3"), 1000);

          return {
            firstName,
            lastName,
          };
        },
      }).mount("#app");
    </script>
  </body>
</html>
